﻿<%@ Page Language="C#" MasterPageFile="~/admin/admin1.master" AutoEventWireup="true" ValidateRequest="False" CodeFile="Categories.aspx.cs" Inherits="admin_Pages_Categories" %>
<%@ Import Namespace="Resources"%>
<asp:Content ID="Content1" ContentPlaceHolderID="cphAdmin" Runat="Server">
    <div class="settings">
  <h1>分类管理</h1>
  <asp:Label ID="lblNewCategory" runat ="server" AssociatedControlID="txtNewCategory" 
          Text="分类标题" /><br />
  <asp:TextBox runat="Server" ID="txtNewCategory" Width="200" /><br />
  <asp:Label ID="lblNewNewDescription" runat ="server" 
          AssociatedControlID="txtNewNewDescription" Text="分类说明" /><br />
  <asp:TextBox runat="Server" ID="txtNewNewDescription" Width="400" TextMode="MultiLine" Rows="4" /><br />
  <asp:Label ID="lblNewParent" runat ="server" AssociatedControlID="ddlNewParent" 
            Text="父分类" /><br />
  <asp:DropDownList ID="ddlNewParent" width="200" runat="server" /><br /><br />
  <asp:Button runat="server" ID="btnAdd" ValidationGroup="new" />
  <asp:CustomValidator runat="Server" ID="valExist" ValidationGroup="new" 
          ControlToValidate="txtNewCategory" ErrorMessage="分类信息已经存在" Display="dynamic" />
  <asp:RequiredFieldValidator runat="Server" ValidationGroup="new" 
          ControlToValidate="txtNewCategory" ErrorMessage="请重新输入！" /><br /><hr />

  <asp:GridView runat="server" ID="grid"
    BorderColor="#f8f8f8" 
    BorderStyle="solid" 
    BorderWidth="1px" 
    RowStyle-BorderWidth="0"
    RowStyle-BorderStyle="None"
    gridlines="None"
    width="100%"
    AlternatingRowStyle-BackColor="#f8f8f8"
    AlternatingRowStyle-BorderColor="#f8f8f8" 
    HeaderStyle-BackColor="#F1F1F1"
    cellpadding="3"
    AutoGenerateColumns="False" 
    AutoGenerateDeleteButton="True" 
    AutoGenerateEditButton="True">
    <Columns>      
      <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="<%$ Resources:labels, name %>">
        <ItemTemplate>
          <%# Server.HtmlEncode(Eval("title").ToString()) %>
        </ItemTemplate>
        <EditItemTemplate>
          <asp:TextBox runat="server" ID="txtTitle" Text='<%# Eval("title") %>' />
        </EditItemTemplate>
      </asp:TemplateField>
      <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="<%$ Resources:labels, description %>">
       <ItemTemplate>
          <%# Server.HtmlEncode(Eval("description").ToString())%>
        </ItemTemplate>
        <EditItemTemplate>
          <asp:TextBox runat="server" MaxLength="255" ID="txtDescription" Text='<%# Eval("description") %>'  />
        </EditItemTemplate>
      </asp:TemplateField>
      <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="父分类">
        <ItemTemplate>
          <%# GetParentTitle(Container.DataItem) %>
        </ItemTemplate>
        <EditItemTemplate>
            <asp:DropDownList ID="ddlParent" runat="server" />
        </EditItemTemplate>
      </asp:TemplateField>
    </Columns>
  </asp:GridView>
  <br />
  <h1>领域管理</h1>
  <asp:Label ID="Label1" runat ="server" AssociatedControlID="txtNewField" 
          Text="领域标题" /><br />
  <asp:TextBox runat="Server" ID="txtNewField" Width="200" /><br />
  <asp:Label ID="Label2" runat ="server" 
          AssociatedControlID="txtNewFieldDescription" Text="领域说明" /><br />
  <asp:TextBox runat="Server" ID="txtNewFieldDescription" Width="400" 
            TextMode="MultiLine" Rows="4" /><br />
        <br />
        
  <asp:Button runat="server" ID="btnAddField" ValidationGroup="newField" 
            onclick="btnAddField_Click" Text="添加领域" />
  <asp:CustomValidator runat="Server" ID="valExist1" ValidationGroup="newField" 
          ControlToValidate="txtNewField" ErrorMessage="领域信息已经存在" Display="dynamic" />
  <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="Server" ValidationGroup="newField" 
          ControlToValidate="txtNewField" ErrorMessage="请重新输入！" /><br /><hr />

  <asp:GridView runat="server" ID="grid1"
    BorderColor="#f8f8f8" 
    BorderStyle="solid" 
    BorderWidth="1px" 
    RowStyle-BorderWidth="0"
    RowStyle-BorderStyle="None"
    gridlines="None"
    width="100%"
    AlternatingRowStyle-BackColor="#f8f8f8"
    AlternatingRowStyle-BorderColor="#f8f8f8" 
    HeaderStyle-BackColor="#F1F1F1"
    cellpadding="3"
    AutoGenerateColumns="False" 
    AutoGenerateDeleteButton="True" 
    AutoGenerateEditButton="True">
    <Columns>      
      <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="<%$ Resources:labels, name %>">
        <ItemTemplate>
          <%# Server.HtmlEncode(Eval("FieldName").ToString())%>
        </ItemTemplate>
        <EditItemTemplate>
          <asp:TextBox runat="server" ID="txtTitle" Text='<%# Eval("FieldName") %>' />
        </EditItemTemplate>
      </asp:TemplateField>
      <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="<%$ Resources:labels, description %>">
       <ItemTemplate>
          <%# Server.HtmlEncode(Eval("description").ToString())%>
        </ItemTemplate>
        <EditItemTemplate>
          <asp:TextBox runat="server" MaxLength="255" ID="txtDescription" Text='<%# Eval("description") %>'  />
        </EditItemTemplate>
      </asp:TemplateField>
    </Columns>
  </asp:GridView>
  </div>
</asp:Content>